<!--
 * @Author: your name
 * @Date: 2020-06-23 08:42:42
 * @LastEditTime: 2021-07-16 17:39:50
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /Tamil-micro-web-ui/micro-app-son/src/views/profile/index.vue
-->
<template>
  <div class="app-container">
    <h1>子应用-测试页面2</h1>
    <div>主应用下发的消息: {{ token || '暂无' }}</div><br>
    <div>获取本地localstorage: {{ userInfo===null?'暂无':userInfo.username }}</div>
  </div>
</template>

<script>

import actions from '@/shared/actions'
export default {
  name: 'Profile',
  data() {
    return {
      token: null,
      userInfo: JSON.parse(localStorage.getItem('userInfo'))
    }
  },
  mounted() {
    actions.onGlobalStateChange(state => {
      const { token } = state
      this.token = token
    }, true)
    console.log(this.userInfo)
  }
}
</script>
